package com.gxsf.back.controller;

import com.gxsf.back.pojo.*;
import com.gxsf.back.repo.*;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author BeijiRonin
 * @date 2020/11/12
 */
@CrossOrigin
@RestController
@RequestMapping("/all_json")
@Slf4j
@Api("所有数据库信息")
public class AllController {
    @Autowired
    AdminRepository adminRepository;
    @Autowired
    LibraryListRepository libraryListRepository;
    @Autowired
    MarkSpeakRepository markSpeakRepository;
    @Autowired
    NoticeRepository noticeRepository;
    @Autowired
    ReserListRepository reserListRepository;
    @Autowired
    UserRepository userRepository;
    @Autowired
    ViolationListRepository violationListRepository;

    @PostMapping("/admin")
    public List<Admin> getAdminRepository() { return adminRepository.findAll(); }

    @PostMapping("/user")
    public List<User> getUserRepository() {
        return userRepository.findAll();
    }

    @PostMapping("/libraryList")
    public List<LibraryList> getLibraryListRepository() {
        return libraryListRepository.findAll();
    }

    @PostMapping("/markSpeak")
    public List<MarkSpeak> getMarkSpeakRepository() {
        return markSpeakRepository.findAll();
    }

    @PostMapping("/notice")
    public List<Notice> getNoticeRepository() {
        return noticeRepository.findAll();
    }

    @PostMapping("/reserList")
    public List<ReserList> getReserListRepository() {
        return reserListRepository.findAll();
    }

    @PostMapping("/violationList")
    public List<ViolationList> getViolationListRepository() {
        return violationListRepository.findAll();
    }
}
